import { ADD_PERSON } from '../constant'

const init = [{ id: 1, name: 'mal', age: 18 }]

export default function person(prevState = init, action) {
  const { type, data } = action
  switch (type) {
    case ADD_PERSON:
      return [data, ...prevState];
    default:
      return prevState
  }
}